#pragma once

#include "snake_move.h"
#include <conio.h>


int main() {
	char op;
	int result = 1;

	init();
	put_money();
	output_map();

	while (1) {
		op = getch();

		switch (op) {
		case 'A': {
			result = snakeMove(0, -1);
			break;
		}

		case 'a': {
			result = snakeMove(0, -1);
			break;
		}

		case 'D': {
			result = snakeMove(0, 1);
			break;
		}

		case 'd': {
			result = snakeMove(0, 1);
			break;
		}

		case 'W': {
			result = snakeMove(-1, 0);
			break;
		}

		case 'w': {
			result = snakeMove(-1, 0);
			break;
		}

		case 'S': {
			result = snakeMove(1, 0);
			break;
		}

		case 's': {
			result = snakeMove(1, 0);
			break;
		}

		default:
			result = 1;
			break;
		}

		output_map();

		if (!result) {
			puts("Gameover!");
			break;
		}
		
	}

}
